package com.itheimaoa.service.privilege.impl;

import java.io.Serializable;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.itheimaoa.domain.QueryResult;
import com.itheimaoa.domain.customer.Customer;
import com.itheimaoa.domain.privilege.Employee;
import com.itheimaoa.service.base.impl.CommonServiceImpl;
import com.itheimaoa.service.privilege.IEmployeeService;

@Service("employeeService")
@Transactional
public class EmployeeServiceImpl extends CommonServiceImpl<Employee> implements IEmployeeService {

	@Override
	public void saveEntity(Employee t) {
		super.saveEntity(t);
	}

	@Override
	public void deleteEntity(Serializable id) {
		super.deleteEntity(id);
	}

	@Override
	public void updateEntity(Employee t) {
		super.updateEntity(t);
	}

	@Override
	public Employee findEntity(Serializable id) {
		return super.findEntity(id);
	}

	@Override
	public Collection<Employee> getEntitys() {
		return super.getEntitys();
	}

	@Override
	public QueryResult<Employee> getQueryResult(Integer firstResult, Integer maxResult, String strWhere, Object[] params, LinkedHashMap<String, String> orderby) {
		return super.getQueryResult(firstResult, maxResult, strWhere, params, orderby);
	}

	@Override
	public Employee checkLogin(String username, String password) {
		String jpql="from Employee o where o.username = ? and o.password = ?";
		List<Employee> employees =this.hibernateTemplate.find(jpql,new Object[]{username,password});
		if(employees!=null && employees.size()>0)
			return employees.get(0);
		return null;
	}

   
}
